package com.osgc.rf.np.url.util.base;

/**
 * url.gen(action) => /action.index.do
 * url.gen(action,method) => /action.method.do
 * url.gen(action,method,params) => /action.method.do?parame1=value1....
 * @author vatana
 */
public class Url {

    public String gen(String action, String method,
            String params) {
        StringBuilder sb = new StringBuilder();
        sb.append("\"");
        sb.append(action);
        sb.append(".");
        sb.append(method);
        sb.append(".osgc");
        sb.append("?");
        if (params.length() > 0) {
            sb.append(params);
            sb.append("&");   
        }
        sb.append("t="+System.currentTimeMillis());
        sb.append("\"");
        return sb.toString();
    }

      public String gen(String action, String method) {
        return gen(action, method,
                "");
    }

    public String gen(String action) {
        return gen(action.toLowerCase(), "index",
                "");
    }
}
